﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Net;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BidPreparation.dto;

namespace BidPreparation.service.impl
{
    internal class HostInfoServiceImpl : HostInfoService
    {
        public Dictionary<string, object> GetHostInfo()
        {
            var dict = new Dictionary<string, object> { };
            /**
            ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard");
            foreach (ManagementObject obj in searcher.Get())
            {
                foreach (PropertyData prop in obj.Properties)
                {
                    Console.WriteLine("===name:" + prop.Name + ",,,value:" + prop.Value);
                }
            }
            **/

            IPHostEntry ipEntry = Dns.GetHostEntry(Dns.GetHostName());
            foreach (var ip in ipEntry.AddressList)
            {
                dict.Add(ip.ToString(), ip.ToString());
            }

            return dict;
        } 
    }
}
